package routes

import (
	"github.com/gin-gonic/gin"
	"test/controller"
	"test/middleware"
)

func CollectRoute(r *gin.Engine) *gin.Engine{
	r.Use(middleware.CORSMiddleware())
	r.POST("/api/auth/register", controller.Register)
	r.POST("/api/auth/Student_login", controller.StudentLogin)
	r.POST("/api/auth/Manager_login", controller.Manger_Login)
	r.POST("/api/auth/course/findall", controller.Find_allcourse)
	r.POST("/api/auth/student/findall",controller.Find_allstudent)
	r.POST("/api/auth/teacher/findall",controller.Find_allteacher)
	r.POST("/api/auth/accounts/findall",controller.Find_allaccount)
	r.POST("/api/auth/student/add",controller.AddStudent)
	r.POST("/api/auth/student/delete",controller.DeleteStudent)
	r.POST("/api/auth/student/find-id",controller.FindStudentByID)
	r.POST("/api/auth/student/update",controller.UpdateStudent)
	r.POST("/api/auth/course/add",controller.AddCourse)
	r.POST("/api/auth/course/delete",controller.DeleteCourse)
	r.POST("/api/auth/course/update",controller.UpdateCourse)
	r.POST("/api/auth/course/find-cno",controller.FindCourseByCno)
	r.POST("/api/auth/teacher/add",controller.AddTeacher)
	r.POST("/api/auth/teacher/delete",controller.DeleteTeacher)
	r.POST("/api/auth/teacher/update",controller.UpdateTeacher)
	r.POST("/api/auth/teacher/find-tno",controller.FindTeacherByTno)
	r.POST("/api/auth/choosecourse",controller.ChoooseCourse)
	r.POST("/api/auth/course/pay",controller.CoursePay)
	r.POST("/api/auth/course/payresult",controller.PayResult)
	r.POST("/api/auth/account/findmoney",controller.Find_Money)
	r.GET("/api/auth/info", middleware.UserMiddleware(), controller.Info)//中间建认证，保护路由
	return r
}
